package com.rzico.account.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum ReceivableStatusEnum {
    /**
     * 状态(0.待收款,1.部份收款,2.已完成)
     */
    RECEIVABLE_STATUS_WAIT(0, "待收款"),
    RECEIVABLE_STATUS_PART(1, "部份收款"),
    RECEIVABLE_STATUS_COMPLETE(2, "已完成");

    private Integer id;
    private String name;

    ReceivableStatusEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        ReceivableStatusEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static ReceivableStatusEnum getById(Integer id) {
        for (ReceivableStatusEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

    public static void main(String args[]){
        System.out.println(ReceivableStatusEnum.getNameById(1));
    }
}
